package com.aiit.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.Getter;

import java.io.Serializable;
import java.time.Duration;
import java.time.LocalDateTime;

/**
 * 订单
 */
@Data
@Builder
@AllArgsConstructor
public class CreateBookingTime implements Serializable {

    private static final long serialVersionUID = 1L;

    private Long id;

    private Integer seat_number = 4;

    private Integer status = 1;

    @Getter
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime session_time;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;

    @Getter
    @JsonFormat(pattern = "yyyy-MM-dd ")
    private LocalDateTime date;
    private Long createUser;
    private Long updateUser;

    public CreateBookingTime() {
        this.session_time = LocalDateTime.now().plusDays(3); // 初始化为当前时间加2小时
        this.date = LocalDateTime.now().plusDays(3);
    }

    public void setSession_time(LocalDateTime session_time) {
        this.session_time = session_time;
    }

    public void setDate(LocalDateTime date) {
        this.date = date;
    }

    public LocalDateTime getTwoHoursLater() {
        return this.session_time.plus(Duration.ofDays(3));
    }

    public LocalDateTime getData() {
        return this.date.plus(Duration.ofDays(3));
    }
}
